import { get } from '@/utils/api'
import { MessagePlugin } from 'tdesign-vue-next'
import router from '@/router'

export const useLogout = async () => {
  const response = await get('/api/user/logout')
  MessagePlugin.closeAll()
  MessagePlugin(response.status, response.message)
  if (response.status === 'success') {
    localStorage.removeItem('role')
    await router.push('/')
  }
}
